package com.ccys.cms.controller.productAndService;


import com.ccys.cms.service.productAndService.ProductGoApotikService;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.web.productAndService.ProductGADto;
import com.ccys.db.entity.TblProductGoApotik;
import com.ccys.db.vo.web.productAndService.ProductGAVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/productAndService")
@Api(tags = "印尼药品管理")
public class ProductGoApotikController {


    @Resource
    private ProductGoApotikService service;

    @PutMapping("productGoApotik")
    @ApiOperation(value = "修改状态", notes = "用的是isShowOnDoctor字段")
    public ResponseResult update(String id, Integer isShowOnDoctor) {

        TblProductGoApotik model = new TblProductGoApotik();
        model.setId(id);
        model.setIsShowOnDoctor(isShowOnDoctor);
        int i = service.updateEntityById(model);
        return ResponseResult.update(i);
    }


    @GetMapping("productGoApotik")
    @ApiOperation(value = "查询分页", notes = "排序字段 t1.name / t1.is_show_on_doctor")
    public ResponseResult<PageInfo<ProductGAVo>, Object> getPage(ProductGADto dto) {
        return service.getPage(dto);
    }


}
